import request from '@/utils/request'
const api_name = '/chapter'

export default{
    // 根据课程id获取课程大纲信息
    getTreeList(courseId){
        return request({
            url:`http://39.98.120.230:8080/api/chapter/treelist/${courseId}`,
            methods: "get"
        })
    },
    addChapter(chapter){
        return request({
            url:`http://39.98.120.230:8080/api/chapter`,
            method: "post",
            data:chapter
        })
    },
    //根据id获取章节信息
    getChapter(id){
        return request({
            url: `http://39.98.120.230:8080/api/chapter/${id}`,
            method: 'get',
          })
    },
    //更新课程章节
    updateChapter(chapter){
        return request({
            url: `http://39.98.120.230:8080/api/chapter/${chapter.id}`,
            method: 'put',
            data:chapter
          })
    },
    deleteById(id){
        return request({
            url: `http://39.98.120.230:8080/api/chapter/${id}`,
            method: 'delete',
          })
    }
}